package cn.lovefix.org.service.impl;

import cn.lovefix.base.pageList;
import cn.lovefix.org.domain.Novel;
import cn.lovefix.org.mapper.NovelMapper;
import cn.lovefix.org.query.QueryNovel;
import cn.lovefix.org.service.NovelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class NovelServiceImpl implements NovelService {
    @Autowired
    private NovelMapper novelMapper;
    @Override
    public List<Novel> findAll() {
        return novelMapper.findAll();
    }

    @Override
    public void del(Long mId) {
        novelMapper.del(mId);

    }

    @Override
    public void update(Novel novel) {
        novelMapper.update(novel);

    }

    @Override
    public void add(Novel novel) {
        novelMapper.add(novel);

    }

    @Override
    public pageList<Novel> query(QueryNovel query) {
        Integer totals = novelMapper.queryBycount(query);
        List<Novel> list = novelMapper.query(query);
        return new pageList<Novel>(totals,list);
    }
}
